package br.com.scaled.view;

import br.com.scaled.R;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;

public class Bola extends View {

	private final int X = 135;
	private final int Y = 81;
	private final int CORDA_1 = 37;
	private final int CASA_1 = 65;
	
	public Bola(Context context) {
		super(context);
	}
	
	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		Paint paint = new Paint();
		
		setBackgroundResource(R.drawable.violaobackgroud);

		desenhar1(canvas, paint);
		desenhar2(canvas, paint);
		desenhar3(canvas, paint);
		desenhar4(canvas, paint);
		desenhar5(canvas, paint);
		desenhar6(canvas, paint);
		
	}
	
	private void desenhar1(Canvas canvas, Paint paint){
		paint.setColor(Color.BLUE);
		canvas.drawCircle(CASA_1, CORDA_1, 20, paint);
		paint.setColor(Color.BLACK);
		canvas.drawCircle(CASA_1, CORDA_1+Y, 20, paint);
		paint.setColor(Color.GRAY);
		canvas.drawCircle(CASA_1, CORDA_1, 20, paint);
		paint.setColor(Color.GREEN);
		canvas.drawCircle(CASA_1, CORDA_1, 20, paint);
		paint.setColor(Color.RED);
		canvas.drawCircle(CASA_1, CORDA_1, 20, paint);
		paint.setColor(Color.YELLOW);
		canvas.drawCircle(CASA_1, CORDA_1, 20, paint);
	}
	
	private void desenhar2(Canvas canvas, Paint paint){
		paint.setColor(Color.BLUE);
		canvas.drawCircle(CASA_1+X, 37, 20, paint);
		paint.setColor(Color.BLACK);
		canvas.drawCircle(200, 118, 20, paint);
		paint.setColor(Color.GRAY);
		canvas.drawCircle(200, 199, 20, paint);
		paint.setColor(Color.GREEN);
		canvas.drawCircle(200, 280, 20, paint);
		paint.setColor(Color.RED);
		canvas.drawCircle(200, 361, 20, paint);
		paint.setColor(Color.YELLOW);
		canvas.drawCircle(200, 442, 20, paint);
	}
	
	private void desenhar3(Canvas canvas, Paint paint){
		paint.setColor(Color.BLUE);
		canvas.drawCircle(335, 37, 20, paint);
		paint.setColor(Color.BLACK);
		canvas.drawCircle(335, 118, 20, paint);
		paint.setColor(Color.GRAY);
		canvas.drawCircle(335, 199, 20, paint);
		paint.setColor(Color.GREEN);
		canvas.drawCircle(335, 280, 20, paint);
		paint.setColor(Color.RED);
		canvas.drawCircle(335, 361, 20, paint);
		paint.setColor(Color.YELLOW);
		canvas.drawCircle(335, 442, 20, paint);
	}
	
	private void desenhar4(Canvas canvas, Paint paint){
		paint.setColor(Color.BLUE);
		canvas.drawCircle(470, 37, 20, paint);
		paint.setColor(Color.BLACK);
		canvas.drawCircle(470, 118, 20, paint);
		paint.setColor(Color.GRAY);
		canvas.drawCircle(470, 199, 20, paint);
		paint.setColor(Color.GREEN);
		canvas.drawCircle(470, 280, 20, paint);
		paint.setColor(Color.RED);
		canvas.drawCircle(470, 361, 20, paint);
		paint.setColor(Color.YELLOW);
		canvas.drawCircle(470, 442, 20, paint);
	}

	private void desenhar5(Canvas canvas, Paint paint){
		paint.setColor(Color.BLUE);
		canvas.drawCircle(605, 37, 20, paint);
		paint.setColor(Color.BLACK);
		canvas.drawCircle(605, 118, 20, paint);
		paint.setColor(Color.GRAY);
		canvas.drawCircle(605, 199, 20, paint);
		paint.setColor(Color.GREEN);
		canvas.drawCircle(605, 280, 20, paint);
		paint.setColor(Color.RED);
		canvas.drawCircle(605, 361, 20, paint);
		paint.setColor(Color.YELLOW);
		canvas.drawCircle(605, 442, 20, paint);
	}
	
	private void desenhar6(Canvas canvas, Paint paint){
		paint.setColor(Color.BLUE);
		canvas.drawCircle(740, 37, 20, paint);
		paint.setColor(Color.BLACK);
		canvas.drawCircle(740, 118, 20, paint);
		paint.setColor(Color.GRAY);
		canvas.drawCircle(740, 199, 20, paint);
		paint.setColor(Color.GREEN);
		canvas.drawCircle(740, 280, 20, paint);
		paint.setColor(Color.RED);
		canvas.drawCircle(740, 361, 20, paint);
		paint.setColor(Color.YELLOW);
		canvas.drawCircle(740, 442, 20, paint);
	}

}
